﻿﻿
using System;
using UnityEngine;

namespace UFrame
{
    public class BoolToSpriteConverter
    {
        public Sprite trueSP;
        public Sprite falseSP;

        public  BoolToSpriteConverter(){}

        public BoolToSpriteConverter(Sprite trueSP, Sprite falseSP)
        {
            this.trueSP = trueSP;
            this.falseSP = falseSP;
        }
        
        public object Convert(object value)
        {
            bool b = System.Convert.ToBoolean(value);
            return b ? trueSP : falseSP;
        }

        public object ConvertBack(object value)
        {
            return value == trueSP;
        }
    }
}